Skip to content

DeepCompile: stabilize ZeRO-3 parameter guards - #8328

Merged
pengdurice merged 1 commit into
deepspeedai:masterfrom
tohtana:tohtana/deepcompile-zero3-parameter-guards
Sep 1, 2026
Merged

pengdurice merged 1 commit into
deepspeedai:masterfrom
tohtana:tohtana/deepcompile-zero3-parameter-guards

Conversation

@tohtana

@tohtana tohtana commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

Under DeepCompile's ZeRO-3, a module parameter can be empty (while partitioned) and full-sized param.data (while gathered). Dynamo could recompile the graph when the status changes.

The eager fallback added in #8059 gathers ZeRO-3 parameters for frames that Dynamo skips, which made these temporary state changes visible during tracing. #8157 prevented one parameter lookup performed during guard evaluation from triggering a gather. However, Dynamo could still build tensor guards from the parameter's temporary gathered or partitioned representation, and ZeROOrderedDict could still read the current ds_status while Dynamo was compiling.

This PR makes Dynamo's graph reuse check compare the parameter's identity and logical properties, including its type, dispatch keys, dtype, device, layout, requires_grad, ds_id, and ds_shape. It does not make the check depend on the temporary param.data shape or ds_status. As the result, DeepCompile can keep Dynamo's existing tensor checks unchanged for non-ZeRO tensors.
When DeepCompile supplies a full-sized placeholder during tracing, it now looks up the corresponding module parameter before building the check. It also returns parameters from ZeROOrderedDict during compilation without reading ds_status.

Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
@tohtana
tohtana marked this pull request as ready for review August 28, 2026 17:22

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e4bcfd9e27

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# PyTorch 2.10 does not yet accept the user stack argument.
guard_manager.add_lambda_guard(semantic_parameter_guard, verbose_code)
return
return original_tensor_match(self, guard, value)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve the older TENSOR_MATCH call signature

On supported PyTorch 2.6/2.7 releases, GuardBuilder.TENSOR_MATCH accepts only (self, guard), but this delegation always supplies the additional value argument. Any ordinary input or other non-ZeRO tensor therefore reaches this branch and raises TypeError while Dynamo builds guards, preventing ZeRO-3 DeepCompile from producing a graph on those versions; call the original without value when its older signature is in use.

Useful? React with 👍 / 👎.

@pengdurice
pengdurice added this pull request to the merge queue Sep 1, 2026
Merged via the queue into deepspeedai:master with commit 4189091 Sep 1, 2026
13 of 15 checks passed
@tohtana tohtana mentioned this pull request Sep 27, 2026
10 of 22 tasks
@auto-pr-labeler-with-jev auto-pr-labeler-with-jev Bot added the skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. label Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants